# -*- coding:utf-8 -*-
#from selenium import webdriver
import time,os
from UI.Element import Element

class AddAdvertising():

    el = Element()

    def addAder(self):
        '''网站-广告管理-增加广告位\互动-主播管理-编辑主播账号(新增主播头像)'''
        driver = AddAdvertising().el
        #登录
        driver.element_by_xpath("//*[@id='app']/div/div/div/div[2]/div/form/div[1]/div/div/input",'admin')
        driver.element_by_xpath("//*[@id='app']/div/div/div/div[2]/div/form/div[2]/div/div/input","123456")
        driver.element_by_xpath("//*[@id='app']/div/div/div/div[2]/div/form/div[3]/div/button/span")
        #网站-广告管理-增加广告位
        # driver.element_by_xpath("//*[@class='side-menu-wrapper']/ul/li[5]/div")
        # time.sleep(2)
        # driver.element_by_xpath("//*[@class='side-menu-wrapper']/ul/li[5]/ul/li[2]")
        # for i in range(1,5):
        #     #新增按钮
        #     time.sleep(2)
        #     driver.element_by_xpath("//*[@class='ivu-layout']/div[2]/div/div/button/span")
        #     time.sleep(2)
        #     #填写广告内容
        #     driver.element_by_xpath("//*[@class='ivu-modal-wrap']/div/div/div[2]/form/div/div/div/input","测试广告")
        #     time.sleep(1)
        #     driver.element_by_xpath("//*[@class='ivu-modal-wrap']/div/div/div[2]/form/div[2]/div/div/div/div/button/span")
        #     time.sleep(1)
        #     os.system(os.getcwd() + r"\updataPic.exe")
        #     time.sleep(2)
        #     driver.element_by_xpath("//*[@class='ivu-modal-wrap']/div/div/div[2]/form/div[2]/div/div/div[2]/button/span")
        #     #设备端
        #     time.sleep(5)
        #     driver.element_by_xpath("//*[@class='ivu-modal-wrap']/div/div/div[2]/form/div[3]/div/div/div/div/div/div/span")
        #     time.sleep(1)
        #     driver.element_by_xpath("//*[@class='ivu-modal-wrap']/div/div/div[2]/form/div[3]/div/div/div/div/div[2]/ul[2]/li["+str(i)+"]")
        #     #位置
        #     time.sleep(1)
        #     driver.element_by_xpath("//*[@class='ivu-modal-wrap']/div/div/div[2]/form/div[3]/div[2]/div/div/div/div/div/span")
        #     time.sleep(1)
        #     driver.element_by_xpath("//*[@class='ivu-modal-wrap']/div/div/div[2]/form/div[3]/div[2]/div/div/div/div[2]/ul[2]/li[1]")
        #     # 轮播广告
        #     time.sleep(1)
        #     driver.element_by_xpath("//*[@class='ivu-modal-wrap']/div/div/div[2]/form/div[4]/div/div/div/div/div/div/span")
        #     time.sleep(1)
        #     driver.element_by_xpath("//*[@class='ivu-modal-wrap']/div/div/div[2]/form/div[4]/div/div/div/div/div[2]/ul[2]/li[1]")
        #     #排序
        #     time.sleep(1)
        #     driver.element_by_xpath("//*[@class='ivu-modal-wrap']/div/div/div[2]/form/div[4]/div[2]/div/div/div/div[2]/input",1)
        #     #类别
        #     time.sleep(1)
        #     driver.element_by_xpath("//*[@class='ivu-modal-wrap']/div/div/div[2]/form/div[5]/div/div/div/div/div/div/span")
        #     time.sleep(1)
        #     driver.element_by_xpath("//*[@class='ivu-modal-wrap']/div/div/div[2]/form/div[5]/div/div/div/div/div[2]/ul[2]/li[1]")
        #     #链接
        #     time.sleep(1)
        #     driver.element_by_xpath("//*[@class='ivu-modal-wrap']/div/div/div[2]/form/div[6]/div/div/div/div/input","www.baidu.com")
        #     #提交
        #     time.sleep(1)
        #     driver.element_by_xpath("//*[@class='ivu-modal-wrap']/div/div/div[3]/div/button/span")
        #     time.sleep(3)
        #     print("增加广告位完成")

        #互动-主播管理-编辑主播账号(新增主播头像)
        # driver.element_by_xpath("//*[@class='side-menu-wrapper']/ul/li[5]/div")
        # time.sleep(1)
        # driver.element_by_xpath("//*[@class='side-menu-wrapper']/ul/li[5]/ul/li")
        # time.sleep(1)
        # driver.element_by_xpath("//*[@class='main-content-wrap ivu-layout-content']/div/div[3]/div/div/div[2]/table/tbody/tr/td[12]/div/div/div/button[2]/span")
        # time.sleep(1)
        # driver.element_by_xpath("//*[@class='v-transfer-dom'][3]/div/div/div/div[2]/form/div[4]/div/div/div/div/div/div/button/span")
        # time.sleep(1)
        # os.system(os.getcwd() + r"\updataPic.exe")
        # time.sleep(2)
        # driver.element_by_xpath("//*[@class='v-transfer-dom'][3]/div[2]/div/div/div[2]/form/div[4]/div/div/div/div/div[2]/button/span")
        # time.sleep(3)
        # driver.element_by_xpath("//*[@class='v-transfer-dom'][3]/div[2]/div/div/div[3]/div/button[2]/span")
        #创建影片主播
        driver.element_by_xpath("//*[@class='side-menu-wrapper']/ul/li[5]/div")
        time.sleep(1)
        driver.element_by_xpath("//*[@class='side-menu-wrapper']/ul/li[5]/ul/li[2]")
        time.sleep(1)
        driver.element_by_xpath("//*[@class='main-content ivu-layout']/div[2]/div/div[2]/div/div/div[2]/button/span")
        time.sleep(1)
        driver.element_by_xpath("//*[@class='modal v-transfer-dom']/div/div/div/div/div[2]/div/div/label")
        time.sleep(1)
        driver.element_by_xpath("//*[@class='modal v-transfer-dom']/div/div/div/div[2]/div/button[2]/span")
        time.sleep(1)
        driver.element_by_xpath("//*[@class='modal v-transfer-dom']/div/div/div/div/div[2]/div/div/label")
        time.sleep(1)
        driver.element_by_xpath("//*[@class='modal v-transfer-dom']/div/div/div/div[2]/div/button[2]/span")
        time.sleep(1)
        driver.element_by_xpath("//*[@class='modal v-transfer-dom']/div/div/div/div/div[2]/ul/li/div/div/div/span")
        time.sleep(1)
        os.system(os.getcwd() + r"\updataPic.exe")
        time.sleep(6)
        driver.element_by_xpath("//*[@class='modal v-transfer-dom']/div/div/div/div/div[2]/ul/li/div")
        time.sleep(1)
        driver.element_by_xpath("//*[@class='modal v-transfer-dom']/div/div/div/div[2]/div/button[2]/span")
        time.sleep(1)
        driver.element_by_xpath("//*[@class='modal v-transfer-dom']/div/div/div/div/div[2]/div/div/label")
        time.sleep(1)
        driver.element_by_xpath("//*[@class='modal v-transfer-dom']/div/div/div/div[2]/div/button[2]/span")
        time.sleep(1)
        driver.element_by_xpath("//*[@class='modal v-transfer-dom']/div/div/div/div/div[2]/div/div/input","test")
        time.sleep(1)
        driver.element_by_xpath("//*[@class='modal v-transfer-dom']/div/div/div/div[2]/div/button[2]/span")
        time.sleep(1)
        driver.element_by_xpath("//*[@class='modal v-transfer-dom']/div/div/div/div[2]/div/button[2]/span")








        #点击互动-影片管理
        # driver.element_by_xpath("//*[@class='side-menu-wrapper']/ul/li[5]/div")
        # time.sleep(1)
        # driver.element_by_xpath("//*[@class='side-menu-wrapper']/ul/li[5]/ul/li[5]")
        # time.sleep(1)
        # driver.element_by_xpath("//*[@class='main ivu-layout ivu-layout-has-sider']/div[2]/div[2]/div/div[2]/button/span")
        # time.sleep(1)
        # driver.element_by_xpath("//*[@class='v-transfer-dom']/div[2]/div/div/div[2]/form/div/div/div/input","zdhtest")
        # time.sleep(1)
        # driver.element_by_xpath("//*[@class='v-transfer-dom']/div[2]/div/div/div[2]/form/div[2]/div/div/div/div/button/span")
        # time.sleep(1)
        # os.system(os.getcwd() + r"\updataV.exe")
        # time.sleep(2)
        # driver.element_by_xpath("//*[@class='v-transfer-dom']/div[2]/div/div/div[3]/button/span")
        # time.sleep(5)
        # print("影片上传完成")











if __name__ == '__main__':
    addA = AddAdvertising().addAder()